<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class CourseComment extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'course_comments';

    protected $fillable = [
        'parent_id',
        'course_id',
        'user_id',
        'content',
        'image',
    ];

    protected $attributes = [
        'image'  => '',
        'parent_id' => 0,
        'audit_status' => 2
    ];

    public function user()
    {
        return $this->belongsTo(User::class,'user_id');
    }


    public function course()
    {
        return $this->belongsTo(Course::class,'course_id');
    }


    public function son()
    {
        return $this->hasMany(CourseComment::class,'parent_id');
    }
}
